package com.example.demo.admin.remote;


import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;


@FeignClient(name = "远程服务名称", fallbackFactory = IntegralClient.IntegralFallbackFactory.class)
public interface IntegralClient {

    /**
     * 积分变更
     *
     * @param
     * @return
     */
    //@PostMapping("/integralChange")
    //BizResult<IntegralRsp> integralChange(@RequestBody IntegralChangeReq integralChangeReq);

    @Slf4j(topic = "remote")
    @Service
    class IntegralFallbackFactory implements FallbackFactory<IntegralClient> {

        @Override
        public IntegralClient create(Throwable throwable) {

            return new IntegralClient() {

               /* @Override
                public BizResult<IntegralRsp> integralChange(IntegralChangeReq integralChangeReq) {
                    log.error("|IntegralClient fallback| integralChange | integralChangeReq:{}", integralChangeReq, throwable);
                    return BizResult.error(BaseErrorCodeEnum.FALLBACK);
                }*/


            };
        }
    }
}
